home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / 80x0393.zip / VIDTYPE.DOC < prev    next >
Text File  |  1993-06-20  |  11KB  |  244 lines

  1.                               VIDTYPE 1.1
  2.                              by Yousuf Khan
  3.  
  4. Introduction
  5. ============
  6.  
  7. You may use this program's executable, VIDTYPE.COM, with no obligations
  8. or fees and include it in any software package, shareware or commercial
  9. as you please. You may use all or parts of this program's source code,
  10. VIDTYPE.ASM, with no fees, and with the sole condition that you
  11. mention me within your own programming ventures.
  12.  
  13. This document divides itself between two sections. The first section
  14. describes how to use this program and how to interpret its information.
  15. The second section describes how it was programmed.
  16.  
  17. (1) How to use this program
  18. ===========================
  19.  
  20. IBM PCs were designed from the beginning to be able to use many
  21. different types of video hardware. Not only that, but PCs can use upto
  22. two different video subsystems at once. This program will identify many
  23. of these adapters, and it will return configurable DOS errorlevels for
  24. testing inside of batchfiles.
  25.  
  26. The following are the command-line parameters you can feed to the
  27. program before running:
  28.  
  29. Param   Function
  30. -----   --------
  31. none    errorlevel based on prim subsystem standard video code
  32. "e"     errorlevel based on prim subsystem extended video code
  33. "2"     errorlevel based on sec subsystem standard video code
  34. both    errorlevel based on sec subsystem extended video code
  35.  
  36. Examples would be:
  37.  
  38. vidtype
  39. vidtype e
  40. vidtype 2
  41. vidtype e2
  42. vidtype 2E
  43.  
  44. You'll note that upper or lower case do not matter.
  45.  
  46. The Standard or Extended video Code:
  47. -----------------------------------
  48. The standard video code returns standard IBM-recognized video adapters,
  49. such as CGA, MDA, MCGA, EGA, or VGA. Just about all video adapters will
  50. return at least one of these codes for compatibility.
  51.  
  52. The extended video code is returned only by extended adapter types like
  53. the various Hercules or Super VGA adapters. The Hercules adapters, for
  54. example, all appear to be standard MDA monochrome adapters to the
  55. standard video code, but they are recognized separately in the extended
  56. video code. Same for the Super VGA adapters, which all appear to be
  57. standard VGA, but separate extended.
  58.  
  59.         Extended MDA errorlevel codes:
  60.         0       no Hercules, regular MDA only
  61.         1       regular Hercules card
  62.         2       Hercules Plus card
  63.         3       Hercules InColor card
  64.  
  65.         Extended VGA errorlevel codes:
  66.         0       regular VGA
  67.         1       ATI
  68.         2       Ahead
  69.         3       Paradise
  70.         4       Oak
  71.         5       Genoa
  72.         6       Cirrus
  73.         7       Chips&Tech
  74.         8       Tseng
  75.         9       ZyMos
  76.         If a VESA BIOS is present, then add 128 to errorlevels returned.
  77.  
  78. The Primary or Secondary Subsystem:
  79. ----------------------------------
  80. The primary video subsystem is the system where DOS and BIOS will send
  81. all their output to at present. The secondary is system is considered to
  82. be dormant, but it to can be used independently by software that
  83. recognizes the existence of two separate subsystems. At any time you can
  84. swap which subsystem is primary or secondary with the DOS MODE command.
  85.  
  86. VIDTYPE will return a screen similar to the one below:
  87.  
  88. VIDTYPE v1.0 (c) 1992, Yousuf J. Khan
  89.     Primary video subsystem:
  90.         Standard video information:
  91.             VGA w/ color analog display
  92.         Extended video information:
  93.             Super VGA: ATI
  94.             VESA BIOS present
  95.     Secondary video subsystem:
  96.         Standard video information:
  97.             no display
  98.         Extended video information:
  99.             no extended info available
  100.  
  101. In the above example, we have a system with a single primary subsystem,
  102. no secondary subsystem. It was determined to be a VGA standard, an ATI
  103. Super VGA extended, and had a VESA BIOS installed.
  104.  
  105. (2) Programming highlights
  106. ==========================
  107.  
  108. You will find the complete assembler source code, VIDTYPE.ASM, included
  109. in this archive. It was written in Masm-style code with Borland's Turbo
  110. Assembler 2.0. Although I've attempted to maintain Masm compatibility as
  111. best as I can, there's no guarantees that it will assemble under Masm.
  112.  
  113. There are four important instance variables in the system. They are
  114. [Std0type], [Ext0type], [Std1type], and [Ext1type]. Each are a byte
  115. long. [Std?type] variables all indicate an IBM standard video adapter
  116. type, such as CGA, MDA, EGA, or VGA. [Ext?type] variables all indicate
  117. extended information (if available) about those adapters, eg. whether an
  118. MDA is also a Hercules-style monographics adapter, or whether a VGA is a
  119. form of Super VGA. [*0type] variables indicate that the information has
  120. been gathered for the primary video subsystem, while [*1type] indicates
  121. info about the secondary subsystem.
  122.  
  123. There is a fifth instance variable, also a byte long, [egatype], which
  124. is used only after the EGA adaptor detection test. Since the EGA can be
  125. either a monochrome or color adaptor, after the test, this instance
  126. variable indicates which one it was. If a monochrome EGA were found, for
  127. example, then the MDA test could be be skipped later. Similarly if a
  128. color EGA were found the CGA tests could be skipped.
  129.  
  130. The first test carried out is the procedure FindVGA. It uses video BIOS
  131. function AX=1A00h, Get Display Combination Code, which is only available
  132. on PS/2, MCGA, and/or VGA systems. If it is detected that this function
  133. is supported by the current machine, then no more work needs to be done
  134. to detect standard video display types, because all the relevant
  135. information is returned in BX by this function. BH contains the display
  136. combination code (DCC) for the secondary subsystem, and BL contains the
  137. DCC for the primary. A list of DCCs is included inside the FindVGA
  138. procedure.
  139.  
  140. However, even though the DCC is returned, it only represents information
  141. relevant to standard video adapter types, tests still need to be done to
  142. determine extended video types. If an MDA is found then the FindHGC
  143. procedure performed afterwards, to determine if it's Hercules. If a VGA
  144. is found then the FindSVGA procedure is performed.
  145.  
  146. The FindSVGA procedure will determine if a VGA has a Super VGA
  147. extension. There are currently 9 distinct SVGA types that it will
  148. identify. Some of the SVGAs can be identified easily by looking for
  149. certain strings at prespecified locations on their BIOS. Other SVGAs
  150. can only be identified by testing for the existence of extended,
  151. brand-specific registers. Whatever the case, it will return a value
  152. between 0 and 9 which will be placed in one of the [ext?type] instance
  153. variables. Later on, FindSVGA will also determine if the BIOS conforms
  154. to the VESA BIOS specfications. If a VESA compliant BIOS is found then
  155. the 7th bit of [ext?type] will be set, in other words increasing the
  156. value of [ext?type] by 128.
  157.  
  158. The FindEGA procedure uses a video BIOS function available only on EGA
  159. and later adapters, Int 10h, AH=12h, BL=10h, GET EGA INFO. If this
  160. function is supported then BX will have been changed upon return. BH
  161. will return the fact that the EGA is either in monochrome or color mode,
  162. which is then be used to set the [egatype] instance variable. No
  163. [ext?type] instance variables are set during this function.
  164.  
  165. The FindEGA procedure is performed next. If the [egatype] instance varb
  166. indicates that a color EGA was found, then this procedure is bypassed.
  167. Otherwise it determines if a CGA is installed by testing for the
  168. presence of 6845 or compatible CRTC at the assumed i/o port location of
  169. color adapters, 3D4h.
  170.  
  171. The FindMono procedure is performed last. If the [egatype] indicates a
  172. mono EGA was found, then this procedure is skipped. Otherwise the same
  173. 6845 detection procedure is performed as with the CGA, but this time at
  174. port location 3B4h. And if it is determined that an MDA adapter is
  175. present, then an extended test for Hercules, FindHGC, is called.
  176.  
  177. The FindHGC procedure is called only after it has been determined that
  178. an MDA exists. It returns a value from 0 to 3 depending whether and what
  179. type of Hercules or compatible card is installed.
  180.  
  181. The Find6845 procedure is used by both FindCGA and FindMono to test for
  182. the presence of a 6845 at their respective assumed locations.
  183.  
  184. The Determine_subsystem procedure is used only by FindEGA, FindCGA, and
  185. FindMono. It will make a determination whether the currently tested
  186. subsystem is the primary or secondary subsystem. It makes this
  187. determination by looking at offset 63h in the BIOS Data Segment (ie.
  188. segment 40h), which contains the value of video base port address. That
  189. is if the color subsystem is active then it will contain 3D4h. If the
  190. mono is active then it will contain 3B4h.
  191.  
  192. The Write_msg procedure displays all this information to the user.
  193.  
  194. The Return_errorlevel procedure parses the command-line and returns a
  195. DOS errorlevel. The only possible command-line parameters are "2" and
  196. "e". If "e" (case-insensitive) is present then the errorlevel returned
  197. will be based on the [ext0type] value. If "2" is on the command-line,
  198. then the errorlevel is based on the [std1type]. If both parameters are
  199. present, then the errorlevel returned is from [ext1type]. If no
  200. parameters are on the command-line, or garbage parameters are on the
  201. command-line then the errorlevel is based on the [std0type] value.*
  202.  
  203. * Note: there is a bug in the command-line parsing here and simply
  204. sending no parameters will not work, you must send garbage parameters.
  205.  
  206. Version History
  207. ===============
  208.  
  209. Vers #  Date    Description
  210. ------  ----    -----------
  211. 1.0     Nov 92  -first release to public
  212.  
  213. 1.1     Nov 92  -fixed a silly bug that made a Tseng mistakenly send the
  214.                 return code for a C&T, and made a ZyMos send the return
  215.                 code for a Tseng. Pointed out by John Olson in Fidonet's
  216.                 80XXX echo.
  217.                 -added Trident chipset detector sent over by the same
  218.                 John Olson, above.
  219.                 -added an installation check for the 8514/A's
  220.                 HDILOAD.EXE driver. Treated like any other Super VGA
  221.                 installation check.
  222.                 -received reports that the C&T chipset test was causing
  223.                 lockups on other people's machines. Have moved test
  224.                 location to the very last position, so hopefully other
  225.                 chipsets have a chance to be detected before this test
  226.                 is performed. May consider commenting over this test
  227.                 entirely, if any more reports come in about lockups.
  228.                 -command-line bug is still present.
  229.  
  230. Conclusion
  231. ==========
  232.  
  233. Well, that's that. I hope you find this program useful. Better yet, I
  234. hope you find this program educational, that's why I included its source
  235. code. If you have any questions, or if you got any hot new Super VGA
  236. detectors that you would want me to implement, write to me at:
  237.  
  238. Postal address: Yousuf J. Khan
  239.                 1007 Alenmede Cres.
  240.                 Ottawa, Ont., Canada
  241.                 K2B 8H2
  242. Fidonet address: 1:163/215.6
  243. Internet address: 1:163/215.6@fidonet.org
  244.